feat(thumbnail): add recipe and tokens#31166
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| cp -r "${CORE_DIR}/src" "${OUTPUT_DIR}/src" | ||
| cp -r "${CORE_DIR}/dist" "${OUTPUT_DIR}/dist" | ||
| cp -r "${CORE_DIR}/css" "${OUTPUT_DIR}/css" | ||
| cp -r "${CORE_DIR}/themes" "${OUTPUT_DIR}/themes" |
There was a problem hiding this comment.
The themes/ directory (generated by npm run build.themes and dynamically imported by scripts.js at runtime as /themes/{theme}/default.tokens.js) wasn't being copied into the Vercel output, so the token modules 404'd in deployed previews while working fine locally where the dev server serves it from core/.
| width: var(--ion-item-divider-thumbnail-width, revert-layer); | ||
| height: var(--ion-item-divider-thumbnail-height, revert-layer); |
There was a problem hiding this comment.
If these tokens are not set then default to the size that was set prior like the original --ion-thumbnail-width/--ion-thumbnail-height.
ShaneK
left a comment
There was a problem hiding this comment.
Minor non-blocking nits, great work!
|
|
||
| ::slotted(ion-thumbnail) { | ||
| --size: #{$item-ios-thumbnail-size}; | ||
| // TODO(FW-6847): replace $item-md-thumbnail-* to revert-layer pattern used in item-divider.scss. Assuming the --ion-item-thumbnail-width/height tokens will be used in the migration, else update them. |
There was a problem hiding this comment.
| // TODO(FW-6847): replace $item-md-thumbnail-* to revert-layer pattern used in item-divider.scss. Assuming the --ion-item-thumbnail-width/height tokens will be used in the migration, else update them. | |
| // TODO(FW-6847): replace $item-ios-thumbnail-* to revert-layer pattern used in item-divider.scss. Assuming the --ion-item-thumbnail-width/height tokens will be used in the migration, else update them. |
Copy-paste from item.md.scss left this referencing $item-md-thumbnail-* even though the file uses $item-ios-thumbnail-* on the next two lines. Since both files carry the same note, a shorter // TODO(FW-6847): adopt the revert-layer pattern from item-divider.scss could also work
| <style> | ||
| ion-thumbnail { | ||
| --ion-item-thumbnail-width: 20px; | ||
| --ion-item-thumbnail-height: 20px; | ||
| } | ||
| </style> |
There was a problem hiding this comment.
Should this set --ion-item-thumbnail-width and --ion-item-thumbnail-height on ion-item instead of ion-thumbnail? The <ion-item-divider> test right below sets the divider variant on ion-item-divider, so the two would line up. It works either way because the property cascades, but the variable name implies it belongs on the parent.
|
|
||
| width: var(--size, 48px); | ||
| height: var(--size, 48px); | ||
| width: var(--ion-thumbnail-width); |
There was a problem hiding this comment.
var(--ion-thumbnail-width) and var(--ion-thumbnail-height) lost the literal fallback that var(--size, 48px) used to give you. I think the token system sets these globally so it's fine in practice, but if a consumer opts out of the default theme or the tokens haven't applied yet, the thumbnail collapses to auto and renders 0x0. Worth keeping a fallback, or is there a guarantee I'm missing?
Issue number: resolves internal
What is the current behavior?
ion-thumbnailis already a single SCSS file (no per-theme fragmentation), but its styles are hardcoded rather than driven by the Modular Ionic token system. The TSX also still callsgetIonThemeand applies a theme class to the host even though all three themes render identically.In addition,
--sizecontrols both width and height with a single token, so non-square thumbnails are not possible without a separatewidth/heightoverride.What is the new behavior?
thumbnail.interfaces.tswith theIonThumbnailRecipetype.--sizeinto--width+--height: Non-square thumbnails are now possible.--size/--border-radiuswith the namespaced--ion-thumbnail-width,--ion-thumbnail-height, and--ion-thumbnail-border-radius.ion-item-divider,ion-item(ios + md theme files) now set--ion-thumbnail-widthand--ion-thumbnail-heightdirectly instead of--size.Does this introduce a breaking change?
This PR introduces breaking changes to how
ion-thumbnailis styled.Migration Path:
--sizeand--border-radiushave been removed. Use the new token structure:Code that previously relied on a single
--sizeoverride must now set both--ion-thumbnail-widthand--ion-thumbnail-height:If per-component customization is needed, the CSS variables can be used directly.
Note: slotted thumbnails inside
ion-itemandion-item-dividercontinue to render at their previous sizes — these components have been updated internally to set the new variables.ion-thumbnail.md,ion-thumbnail.ios.Other information
Preview: